// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using System;
using KnessetCore.Members;

namespace KnessetCore.Members.Views
{
	/// <summary>
	/// Represents a result from a db or web query that allows easy display on the grid control.
	/// Any extra information for various grid controls will be implemented in subclasses of this class.
	/// </summary>
	public class MemberView
	{
		/// <summary>
		/// Name of the knesset member as displayed in the grid.
		/// </summary>
		private string name;
		/// <summary>
		/// Contains a link to the img to display.
		/// </summary>
		private readonly string imgLink;
		/// <summary>
		/// Contains a link to the knesset member's web page on the knesset site.
		/// </summary>
		private readonly string knessetLink;

		/// <summary>
		/// Create a new view of the knesset member.
		/// </summary>
		/// <param name="name">Name of the knesset member as displayed in the grid.</param>
		/// <param name="imgLink">Contains a link to the img to display.</param>
		/// <param name="knessetLink">Contains a link to the knesset member's web page on the knesset site.</param>
		public MemberView(string name, string imgLink, string knessetLink)
		{
			if (name == null) throw new ArgumentNullException("name");
			if (imgLink == null) throw new ArgumentNullException("imgLink");
			if (knessetLink == null) throw new ArgumentNullException("knessetLink");
			this.name = name;
			this.imgLink = imgLink;
			this.knessetLink = knessetLink;
		}

		/// <summary>
		/// Name of the knesset member as displayed in the grid.
		/// </summary>
		public string Name
		{
			get { return name; }
			set
			{
				if (value == null)
				{
					throw new ArgumentNullException("Name can not be null.");
				}
				name = value;
			}
		}

		/// <summary>
		/// Contains a link to the img to display.
		/// </summary>
		public string ImgLink
		{
			get { return imgLink; }
		}

		/// <summary>
		/// Contains a link to the knesset member's web page on the knesset site.
		/// </summary>
		public string KnessetLink
		{
			get { return knessetLink; }
		}
	}
}